import { Body, Controller, Post } from '@nestjs/common';
import { SmsService } from './sms.service';
import { ApiTags } from '@nestjs/swagger';

@ApiTags('短信模块')  
@Controller('components/sms')
export class SmsController {
  constructor(private smsService: SmsService) {}

  @Post('/sendCode')
  async registerCode(@Body() data) {
    const code = Math.random().toString().slice(-6);
    return this.smsService.registerCode({
      ...data,
      TemplateID: '1761555',
      params: [code],
    });
  }
}
